package cn.darven.config;

import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Objects;
import java.util.Properties;

/**
 * @author darven
 * @date 2025/11/3
 * @description 配置加载器
 */
public class ConfigLoader {
    public static Properties properties=new Properties();

    // 加载配置
    static {
        try {
            properties.load(new InputStreamReader(Objects.requireNonNull(ConfigLoader.class.getClassLoader().getResourceAsStream("config.properties"))));
        } catch (IOException e) {
            throw new RuntimeException("加载配置失败",e);
        }
    }

    public static String get(String key){
        return properties.getProperty(key);
    }
}
